package com.es.disped.dao.mapper;

import com.es.disped.dao.model.Role;
import com.es.disped.dao.model.RoleExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface RoleMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @SelectProvider(type=RoleSqlProvider.class, method="countByExample")
    long countByExample(RoleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @DeleteProvider(type=RoleSqlProvider.class, method="deleteByExample")
    int deleteByExample(RoleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @Delete({
        "delete from role",
        "where role_id = #{roleId,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(String roleId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @Insert({
        "insert into role (role_id, role_parent_id, ",
        "role_name, role_code, ",
        "role_index, role_type, ",
        "role_level, role_valid)",
        "values (#{roleId,jdbcType=CHAR}, #{roleParentId,jdbcType=CHAR}, ",
        "#{roleName,jdbcType=VARCHAR}, #{roleCode,jdbcType=VARCHAR}, ",
        "#{roleIndex,jdbcType=INTEGER}, #{roleType,jdbcType=VARCHAR}, ",
        "#{roleLevel,jdbcType=INTEGER}, #{roleValid,jdbcType=INTEGER})"
    })
    int insert(Role record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @InsertProvider(type=RoleSqlProvider.class, method="insertSelective")
    int insertSelective(Role record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @SelectProvider(type=RoleSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="role_parent_id", property="roleParentId", jdbcType=JdbcType.CHAR),
        @Result(column="role_name", property="roleName", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_code", property="roleCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_index", property="roleIndex", jdbcType=JdbcType.INTEGER),
        @Result(column="role_type", property="roleType", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_level", property="roleLevel", jdbcType=JdbcType.INTEGER),
        @Result(column="role_valid", property="roleValid", jdbcType=JdbcType.INTEGER)
    })
    List<Role> selectByExample(RoleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @Select({
        "select",
        "role_id, role_parent_id, role_name, role_code, role_index, role_type, role_level, ",
        "role_valid",
        "from role",
        "where role_id = #{roleId,jdbcType=CHAR}"
    })
    @Results({
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="role_parent_id", property="roleParentId", jdbcType=JdbcType.CHAR),
        @Result(column="role_name", property="roleName", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_code", property="roleCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_index", property="roleIndex", jdbcType=JdbcType.INTEGER),
        @Result(column="role_type", property="roleType", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_level", property="roleLevel", jdbcType=JdbcType.INTEGER),
        @Result(column="role_valid", property="roleValid", jdbcType=JdbcType.INTEGER)
    })
    Role selectByPrimaryKey(String roleId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @UpdateProvider(type=RoleSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @UpdateProvider(type=RoleSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Role record, @Param("example") RoleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @UpdateProvider(type=RoleSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Role record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Mon Jul 01 01:34:02 CST 2019
     */
    @Update({
        "update role",
        "set role_parent_id = #{roleParentId,jdbcType=CHAR},",
          "role_name = #{roleName,jdbcType=VARCHAR},",
          "role_code = #{roleCode,jdbcType=VARCHAR},",
          "role_index = #{roleIndex,jdbcType=INTEGER},",
          "role_type = #{roleType,jdbcType=VARCHAR},",
          "role_level = #{roleLevel,jdbcType=INTEGER},",
          "role_valid = #{roleValid,jdbcType=INTEGER}",
        "where role_id = #{roleId,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(Role record);
}